home *** CD-ROM | disk | FTP | other *** search
- /*
- * Source - DrawMyStuff.c
- * Author - Mark Bykerk Kauffman
- * Purpose - To demonstrate how to create instances of objects and send them
- * messages using Think C 4.0. Call this function in the Draw
- * method for the Pane of your application.
- *
- */
-
- #include "oops.h"
- #include "CShape.h"
-
- /*
- * oops.h is included so the compiler knows how to deal with the object
- * oriented-programming in this section of code. CShape.h is included
- * so all of the shapes defined in CShape.h are available.
- */
-
- void DrawMyStuff()
- {
- int i;
- CLine *ALine;
- COval *AnOval[4];
- CRectangle *ARectangle[4];
-
- for (i=0;i<4;i++)
- ARectangle[i] = new(CRectangle);
- ARectangle[0]->SetShapeLoc(200,100,300,200);
- ARectangle[1]->SetShapeLoc(210,110,290,190);
- ARectangle[2]->SetShapeLoc(220,120,280,180);
- ARectangle[3]->SetShapeLoc(230,130,270,170);
- for (i=0;i<4;i++)
- ARectangle[i]->Draw();
-
- ALine = new(CLine);
- ALine->SetShapeLoc(210,110,290,110);
- ALine->Erase();
- ALine->SetShapeLoc(100,50,300,50);
- ALine->Draw();
-
- for (i=0;i<4;i++)
- AnOval[i] = new(COval);
- AnOval[0]->SetShapeLoc(100,100,200,200);
- AnOval[1]->SetShapeLoc(110,110,190,190);
- AnOval[2]->SetShapeLoc(120,120,180,185);
- AnOval[3]->SetShapeLoc(130,130,170,170);
- for (i=0;i<4;i++)
- AnOval[i]->Draw();
-
- for (i=0;i<4;i++)
- {
- delete(ARectangle[i]);
- delete(AnOval[i]);
- }
- delete(ALine);
- }
-